
<div class="form-group">
	<label class="col-lg control-label">排序</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon.shareticket' $item}
		<input type="text" name="order" class="form-control" value="{$item['order']}"  />
		<span class='help-block'>数字越大越靠前</span>
		{else}
		<div class='form-control-static'>{$item['order']}</div>
		{/if}
	</div>
</div>

<div class="form-group">
	<label class="col-lg control-label must">发券条件</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon.shareticket' $item}
		<div class="input-group">
			<input type='number' class='form-control' name='enough' value="{$item['enough']}" data-rule-required="true"/>
			<span class="input-group-addon">元</span>
		</div>
		<span class='help-block'>单笔订单满足此金额发送，0为任意订单可发，发送条件不可重复</span>
		{else}
		<div class='form-control-static'>{if $item['enough']>0}满 {$item['enough']} 可用 {else}不限制{/if}</div>
		{/if}
	</div>
</div>


<div class="form-group">
	<label class="col-lg control-label">设置活动时间</label>
	<div class="col-xs-12 col-sm-8">
		<div class="input-group">
			{ife 'sale.coupon.shareticket' $item}
			<label class="radio radio-inline">
				<input type="radio" name="expiration" value="1" {if intval($item['expiration']) ==1 }checked="checked"{/if}> 是
			</label>
			<label class="radio radio-inline">
				<input type="radio" name="expiration" value="0" {if intval($item['expiration']) ==0}checked="checked"{/if}> 否
			</label>
			{else}
			<div class='form-control-static'>{if intval($item['expiration']) ==1 }开启{else}关闭{/if}</div>
			{/if}
		</div>
	</div>
</div>

<div class="form-group presell_info" {if intval($item['expiration']) == 0}style="display:none"{/if} id="exptime">
<label class="col-lg control-label">活动有效期限</label>
<div class="col-sm-9 col-xs-12">
	{ife 'sale.coupon.shareticket' $item}
	<div class="input-group">
            <span class="input-group-addon">
                开始时间
            </span>
		{php echo tpl_form_field_date('starttime', !empty($item['starttime']) ? date('Y-m-d H:i',$item['starttime']) : date('Y-m-d H:i'),true)}
            <span class="input-group-addon">
                结束时间
            </span>
		{php echo tpl_form_field_date('endtime', !empty($item['endtime']) ? date('Y-m-d H:i',$item['endtime']) : date('Y-m-d H:i'),true)}
	</div>
	<span class='help-block'></span>
	{else}
	<div class='form-control-static'>
		{if $item['expiration']==1} {php echo date('Y-m-d H:i',$item['starttime'])} - {php echo date('Y-m-d H:i',$item['endtime'])} {/if}
	</div>
	{/if}
</div>
</div>





<div class="form-group">
	<label class="col-lg control-label must">分享标题</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon.shareticket' $item}
		<input type="text" name="share_title" id="share_title" class="form-control" value="{$item['sharetitle']}" data-rule-required="true"/>
		<span class='help-block'>分享标题的字数长度不能超过12</span>
		{else}
		<div class='form-control-static'>{$item['share_title']}</div>
		{/if}
	</div>
</div>

<div class="form-group">
	<label class="col-lg control-label">分享图标</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon.shareticket' $item}
		{php echo tpl_form_field_image2('share_icon', $item['shareicon'])}
		<span class='help-block'>如果不选择，默认为店铺图标</span>
		{else}
		{if !empty($item['share_icon'])}
		<a href='{php echo tomedia($item['shareicon'])}' target='_blank'>
		<img src="{php echo tomedia($item['shareicon'])}" style='width:100px;border:1px solid #ccc;padding:1px' />
		</a>
		{/if}
		{/if}
	</div>
</div>
<div class="form-group">
	<label class="col-lg control-label" must>分享描述</label>
	<div class="col-sm-9 col-xs-12">
		{ife 'sale.coupon.shareticket' $item}
		<textarea name="share_desc" class="form-control" rows="5">{$item['sharedesc']}</textarea>
		<span class='help-block'>如果不填写，则使用系统随机描述</span>
		{else}
		<div class='form-control-static'>{$item['share_desc']}</div>
		{/if}
	</div>
</div>



<div class="form-group">
	<label class="col-lg control-label">使用统一优惠券</label>
	<div class="col-xs-12 col-sm-8">
		<div class="input-group">
			{ife 'sale.coupon.shareticket' $item}
			<label class="radio radio-inline">
				<input type="radio" name="issync" value="0" {if intval($item['issync']) ==0}checked="checked"{/if}> 是
			</label>
			<label class="radio radio-inline">
				<input type="radio" name="issync" value="1" {if intval($item['issync']) ==1 }checked="checked"{/if}> 否
			</label>
			{else}
			<div class='form-control-static'>{if intval($item['status']) ==1 }开启{else}关闭{/if}</div>
			{/if}
		</div>
	</div>
</div>

<div>
	<div class="form-group">
		{ife 'sale.coupon.shareticket' $item}
		<label class="col-lg control-label must" id="stitle">选择优惠券</label>
		<div class="col-sm-9 col-xs-12" id="share1">
			{php echo tpl_selector('couponid',array('required'=>false,'multi'=>1,'type'=>'coupon_share','autosearch'=>1, 'preview'=>true,'url'=>webUrl('sale/coupon/querycplist'),'text'=>'couponname','items'=>$coupons_pay,'readonly'=>true,'buttontext'=>'选择优惠券','placeholder'=>'请选择优惠券'))}
		</div>

		{else}

		{if !empty($item)}
		<table class="table">
			<thead>
			<tr>
				<th style='width:100px;'>优惠券名称</th>
				<th style='width:200px;'></th>
				<th></th>
				<th>优惠券数量</th>
			</tr>
			</thead>
			<tbody id="param-items" class="ui-sortable">
			{loop $coupon $row}
			<tr class='multi-product-item' data-id="{$row['id']}">
				<input type='hidden' class='form-control img-textname' readonly='' value="{$row['couponname']}">
				<input type='hidden' value="{$row['id']}" name="couponid[]">
				<td style='width:80px;'>
					<img src="{php echo tomedia($row['thumb'])}" style='width:70px;border:1px solid #ccc;padding:1px'>
				</td>
				<td style='width:220px;'>{$row['couponname']}</td>
				<td>
					<input class='form-control valid' type='text' disabled value="{$item['coupontotal']}" name="coupontotal{$row['id']}">
				</td>
				<td>
					<input class='form-control valid' type='text' disabled value="{$item['couponlimit']}" name="couponlimit{$row['id']}">
				</td>
			</tr>
			{/loop}
			</tbody>
		</table>
		{else}
		暂无优惠券
		{/if}
		{/if}
	</div>

	</div>


<div class="sync_n" {if intval($item['issync']) == 0}style="display:none"{elseif intval($item['issync']) == 1}style="display:block"{/if}>

	<div class="form-group">
		{ife 'sale.coupon.shareticket' $item}
		<label class="col-lg control-label must">被分享人优惠券</label>
		<div class="col-sm-9 col-xs-12" id="share2">
			{php echo tpl_selector('couponids',array('required'=>false,'multi'=>1,'type'=>'coupon_shares','autosearch'=>1, 'preview'=>true,'url'=>webUrl('sale/coupon/querycplist'),'text'=>'couponname','items'=>$coupons_share,'readonly'=>true,'buttontext'=>'选择优惠券','placeholder'=>'请选择优惠券'))}
		</div>
		{else}

		{if !empty($item)}
		<table class="table">
			<thead>
			<tr>
				<th style='width:100px;'>优惠券名称</th>
				<th style='width:200px;'></th>
				<th></th>
				<th></th>
			</tr>
			</thead>
			<tbody id="param-itemsss" class="ui-sortable">
			{loop $coupon $row}
			<tr class='multi-product-item' data-id="{$row['id']}">
				<input type='hidden' class='form-control img-textname' readonly='' value="{$row['couponname']}">
				<input type='hidden' value="{$row['id']}" name="couponids[]">
				<td style='width:80px;'>
					<img src="{php echo tomedia($row['thumb'])}" style='width:70px;border:1px solid #ccc;padding:1px'>
				</td>
				<td style='width:220px;'>{$row['couponname']}</td>
				<td>
					<input class='form-control valid' type='text' disabled value="{$item['coupontotal']}" name="coupontotal{$row['id']}">
				</td>
				<td>
					<input class='form-control valid' type='text' disabled value="{$item['couponlimit']}" name="couponlimit{$row['id']}">
				</td>
			</tr>
			{/loop}
			</tbody>
		</table>
		{else}
		暂无优惠券
		{/if}
		{/if}
	</div>
</div>




<div class="form-group">
	<label class="col-lg control-label">状态</label>
	<div class="col-xs-12 col-sm-8">
		<div class="input-group">
			{ife 'sale.coupon.shareticket' $item}
			<label class="radio radio-inline">
				<input type="radio" name="status" value="1" {if intval($item['status']) ==1 }checked="checked"{/if}> 开启
			</label>
			<label class="radio radio-inline">
				<input type="radio" name="status" value="0" {if intval($item['status']) ==0}checked="checked"{/if}> 关闭
			</label>
			{else}
			<div class='form-control-static'>{if intval($item['status']) ==1 }开启{else}关闭{/if}</div>
			{/if}
		</div>
	</div>
</div>

